<template>
  <div class="collection">

    <div class="type">
      <div class="type-head">
        <el-image class="type-text" :src="require('@/assets/logo/logoH.png')" @click="pushHome()"/>
      </div>

      <form class="find-button">
        <input class="find-input" type="text" placeholder="请输入您要搜索的内容..." v-model="searchText">
        <button class="find-click" type="submit" @click="searchButton()"><i class="el-icon-search"/></button>
      </form>
    </div>

    <div style="text-align: center; font-size: 20px; font-weight: bold;">
      <i class="el-icon-s-grid" style="color: rgb(200, 200, 200)"></i>
      <i class="el-icon-s-grid" style="color: rgb(200, 200, 200)"></i>
      为你推荐好券
      <i class="el-icon-s-grid" style="color: rgb(200, 200, 200)"></i>
      <i class="el-icon-s-grid" style="color: rgb(200, 200, 200)"></i>
    </div>

    <div v-if="list.length === 0" style="width: 1300px; margin: 20px auto;">请等待更多优惠券发放......</div>

    <div style="width: 1400px; margin: 20px auto;">
      <div
        style="position: relative; float:left; width: 400px; margin: 0 0 20px 50px; height: 149px; border: 1px solid #f2f2f2; box-shadow: 0 10px 20px 0 rgb(0 0 0 / 4%); background-color: white;"
        v-for="item in list" :key="item.id">
        <el-image
          style="width: 100px; height: 100px; margin: 23.5px; float:left;"
          :src="item.couponImg"
          fit="cover"></el-image>

        <div style="position: relative; width: 180px; float:left; margin-top: 10px;">
          <span style="display:inline-block; font: 400 18px Arial; color: #f23030; vertical-align:top;">￥</span>
          <span style="display:inline-block; font: 400 34px Arial; color: #f23030; vertical-align:top;">{{ item.amount }}</span>
          <span style="display:inline-block; font-size: 12px; color: #f23030; background: #fff4ec; vertical-align: top; margin: 12px 0 0 10px;">满{{ item.minPoint }}元可用</span>
          <div style="height: 54px; overflow: hidden; line-height: 18px; font-size: 14px; font-weight: 700; margin: 5px 0 0 15px; cursor: default;">
            <span v-if="item.useType === 0">全场通用</span>
            <span v-if="item.useType === 1">仅可购买属于</span>
            <span v-if="item.useType === 2">仅可购买</span>
            <span v-for="n in item.spuOrCategoryVOList" :key="n.id" class="pushInfoButton">
              {{ '【' + n.name + '】' }}
            </span>
            <span v-if="item.useType === 1">分类的商品</span>
            <span v-if="item.useType === 2">商品</span>
          </div>
          <div style="font-size: 12px; font-weight: 700; cursor: default; float: right; margin-top: 10px;">{{ '可领取 x' + item.perLimit }}</div>
        </div>

        <div
          style="width: 52px; height: 147px; top: 0; right: 0; display: block; position: absolute; background-image: linear-gradient(to bottom,#fb0f3a 0,#f02353 100%);"
          class="getButton"
          @click="receiveButton(item.id)">
          <b style="position: absolute; z-index: 2; top: 0; left: -1px; display: block; width: 3px; height: 100%;"
          :style="{background:'url('+couponSmallCircle+') top left repeat-y'}"></b>
          <span style="width: 20px; font-size: 16px; color: white; display: block; position: relative;top: 35px; margin: 0 auto;">立即领取</span>
        </div>
      </div>
    </div>

  </div>
</template>

<script>

export default {
  name: 'Collection',
  data() {
    return {
      couponSmallCircle: require('@/assets/coupon/small-circle.png'),
      list: [],
      searchText: ''
    }
  },
  created() {
    this.getCoupon()
  },
  methods: {
    receiveButton(id){
      this.$store.dispatch('coupon/coupon/receiveCoupon', id)
        .then(() => {
          this.$message({
            message: "领取成功",
            type: "success"
          });
          this.getCoupon()
        }).catch(()=>{})
    },
    getCoupon(){
      this.$store.dispatch('coupon/coupon/getReceiveCoupon')
        .then(({data}) => {
          console.log(data)
          this.list = data
        }).catch(()=>{})
    },
    searchButton(){

    },
    pushHome(){
      this.$router.push('/collection')
    }
  }
}
</script>

<style lang="scss">
.el-card__body {
  padding: 0px;
}
.el-badge__content{
  background-color: rgb(60,133,39);
}
</style>

<style lang="scss" scoped>
.getButton{
  &:hover {
    cursor: pointer;
    font-weight: bold;
  }
}

.pushInfoButton{
  &:hover {
    cursor: pointer;
    color: rgb(60, 133, 39);
  }
}

.categoryButton {
  color: rgb(176,176,176);

  &:hover {
    cursor: pointer;
    color: rgb(90,181,35);
  }
}

.find-button {
  background-color: white;
  position: relative;
  width: 400px;
  float: right;
  //margin-right: 400px;
  border: 1px solid rgb(178,178,178);
  margin-top: 19px;

  .find-input {
    background: transparent;
    width: 100%;
    height: 42px;
    padding-left: 13px;
    padding-right:46px;
    border: none;
    outline: none;
    font-size: 10px;
  }

  .find-click {
    background: transparent;
    top: 0;
    right: 0;
    height: 42px;
    width: 42px;
    cursor: pointer;
    position: absolute;
    border: none;
    outline: none;
  }
}

.inline-div {
  display: inline-block;
}
.collection {
  min-height: 840px;
  height: 100%;
  width: 100%;
  background-color: rgb(245,245,245);

  .collection_menu{
    width: 1300px;
    height: 500px;
    margin: 0 auto;

    .collection_menu_left{
      background-color: rgb(81,79,78);
      height: 500px;

      .collection_menu_left_input{
        height: 50px;
        line-height: 50px;
        padding-left: 30px;
        color: white;
        font-weight: bold;
        font-size: 14px;

        &:hover{
          cursor: pointer;
          background-color: rgb(79,159,52);
        }
      }
    }

    .collection_menu_right{
      width: 100%;
      height: 500px;
      background-color: rgb(255, 255, 255);
    }
  }

  .type {
    width: 1300px;
    height: 80px;
    margin: 0 auto;
    text-align: center;
    //padding-top: 20px;
    //padding-bottom: 20px;

    .type-head {
      width: 130px;
      height: 80px;
      line-height: 80px;
      display: inline-block;
      float: left;

      .type-text {
        height: 50px;
        width: 130px;
        margin-top: 15px;
        //display: inline-block;
        //font-size: 16px;
        //margin-top: 13px;
        //margin-right: 20px;
        //float: left;

        &:hover {
          cursor: pointer;
          //color: rgb(79,159,52);
        }
      }
    }

    .cartButton{
      width: 150px;
      height: 42px;
      line-height: 42px;
      display: inline-block;
      float: right;
      margin-top: 19px;
      font-size: 13px;
      margin-left: 40px;
      border: 1px solid rgb(200, 200, 200);
      background-color: rgb(230, 230, 230);
      color: rgb(60,133,39);
      z-index: 51;
      position: relative;

      .pushCart{
        &:hover{
          cursor: pointer;
        }
      }
    }
    .moreCart{
      position: absolute;
      top: 60px;
      right: 301px;
      width: 350px;
      background-color: white;
      z-index: 50;
      border: 1px solid rgb(200,200,200);

      .moreCartProduct{


        .moreCartDetail{
          height: 70px;
          padding: 10px;

          .moreCartDetailImg{
            width: 50px;
            height: 50px;
            float: left;

            &:hover{
              cursor: pointer;
            }
          }

          &:hover{
            background-color: rgb(230,230,230);
          }
        }

        .moreCartDetailDel{
          margin-top: 5px;

          &:hover{
            cursor: pointer;
            color: rgb(60,133,39);
          }
        }

        .moreCartDetailTitle{
          display: inline-block;
          float: left;
          color: rgb(102,102,102);
          margin-left: 10px;
          text-align: left;
          width: 100px;
          height: 50px;
          line-height: 17.5px;
          font-size: 12px;
          text-overflow: ellipsis;
          -o-text-overflow: ellipsis;
          overflow: hidden;

          &:hover{
            cursor: pointer;
            color: rgb(60,133,39);
          }
        }
      }

      .moreCartBottom{
        height: 50px;
        background-color: rgb(230,230,230);

        span{
          display: inline-block;
          float: left;
          line-height: 50px;
          margin-left: 10px;
        }

        .morePushCart{
          float: right;
          width: 60px;
          height: 30px;
          line-height: 30px;
          text-align: center;
          margin-top: 10px;
          background-color: rgb(60,133,39);
          color: white;
          font-size: 12px;
          font-weight: bold;
          border-radius: 5px;
          margin-right: 10px;

          &:hover{
            cursor: pointer;
          }
        }
      }
    }
  }
}

.seckill{
  height: 260px;
  width: 1300px;
  margin: 20px auto;

  .seckill-left{
    display: inline-block;
    height: 260px;
    width: 190px;

    .seckill-left-text{
      height: 50px;
      width: 190px;
      font-size: 30px;
      color: white;
      font-weight: bold;
      text-align: center;
      padding-top: 40px;
      float: left;
    }

    .seckill-left-text1{
      height: 50px;
      width: 190px;
      font-size: 15px;
      color: white;
      text-align: center;
      padding-top: 120px;
      float: left;
    }

    .seckill-left-text2{
      height: 50px;
      width: 190px;
      font-size: 20px;
      color: white;
      font-weight: bold;
      text-align: center;
      padding-top: 30px;
      float: left;

      .seckill-left-text2-one{
        width: 30px;
        height: 30px;
        background-color: rgb(47,52,48);
        display: inline-block;
        padding-top: 4px;
      }
    }

    &:hover{
      cursor: pointer;
    }
  }

  .seckill-right{
    height: 260px;
    width: 1110px;
    display: inline-block;
    background-color: white;

    .seckill-right-item{
      display: inline-block;
      height: 260px;
      width: 200px;
      text-align: center;
      margin-left: 18px;

      .seckill-right-item-image{
        display: inline-block;
        width: 140px;
        height: 140px;
        float: left;
        margin-left: 30px;
        margin-top: 30px;
      }

      .seckill-right-item-text{
        width: 200px;
        height: 20px;
        float: left;
        margin-top: 10px;
        font-size: 12px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        line-height: 23px;
        max-height: 20px;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
      }

      .seckill-right-item-pay{
        width: 200px;
        height: 20px;
        float: left;
        color: #e1251b;
        font-size: 12px;
        font-weight: 700;
        margin-top: 15px;
      }

      &:hover{
        cursor: pointer;
        color: rgb(60,135,39);
      }
    }
    .seckill-right-more{
      padding-top: 20px;
      height: 260px;
      width: 1100px;
      display: inline-block;
      text-align: center;
      color: rgb(60,135,39);
      font-weight: bold;
      font-size: 20px;
      float: left;

      &:hover{
        background-color: rgb(117,117,117);
        cursor: pointer;
      }
    }
  }
}

.tag_menu{
  width: 1300px;
  margin: 0 auto;
}
.tag {
  height: 60px;
  width: 1300px;
  background-color: rgb(60,135,39);
  text-align: center;
  //margin: 20px auto;
  //margin-left: 300px;
  margin-top: 20px;
  margin-bottom: 20px;

  .span-more {
    display: block;
    font-size: 15px;
    float: right;
    margin-right: 20px;
    height: 40px;
    width: 80px;

    &:hover {
      cursor: pointer;
      border-bottom: 2px solid white;
    }
  }
}
.tag span {
  line-height: 60px;
  color: white;
  font-size: 20px;
  font-weight: bold;
  float: left;
  margin-left: 20px;
}

.store {
  // background: url("../../assets/storeBox/storeBox.jpg");
  background-color: rgb(245,245,245);
}
.store-div {
  width: 1325px;
  height: 100%;
  //margin-left: 275px;

  .title-span {
    display: inline-block;
    margin-top: 35px;
    font-size: 13px;
    font-weight: bold;
    height: 46px;
    width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    line-height: 23px;
    max-height: 46px;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-left: 15px;
  }
}
.store-list {
  width: 240px;
  height: 340px;
  margin-right: 25px;
  margin-bottom: 25px;
  text-align: center;
  border-top: 5px solid white;
  border-bottom: 5px solid white;
  border-left: 5px solid white;
  border-right: 5px solid white;
  background-color: white;

  .store-list-image {
    margin-top: 30px;
    width: 150px;
    height: 150px;
  }

  .title {
    display: inline-block;
    margin: 0 auto;
    //border-top: 4px solid #000000;
    //background-color: rgb(168,127,16);
    //border-top: 2px solid rgb(216,171,54);
    //border-left: 2px solid rgb(216,171,54);
    //border-bottom: 2px solid rgb(79,54,0);
    //border-right: 2px solid rgb(79,54,0);
    //border-radius: 3px;
    width: 200px;
    height: 25px;
  }

  .title-div {
    height: 20px;
    text-align: left;

    span {
      display: inline-block;
      font-size: 20px;
      font-weight: bold;
      color: red;
    }

    .title-money {
      width: 25px;
      height: 25px;
      vertical-align: middle;
      // margin-left: 20px;
    }
  }

  //.title-border {
    //display: inline-block;
    //width: 206px;
    //height: 46px;
    //margin: 0px auto;
    //background-color: black;
    //border-radius: 6px;

    //&:hover {
      //.title {
      //  cursor: pointer;
      //  display: inline-block;
      //  //border-top: 4px solid #000000;
      //  margin: 3px auto;
      //  background-color: rgb(198,198,198);
      //  border-top: 2px solid rgb(248,250,249);
      //  border-left: 2px solid rgb(248,250,249);
      //  border-bottom: 2px solid rgb(87,87,87);
      //  border-right: 2px solid rgb(87,87,87);
      //  width: 200px;
      //  height: 40px;
      //  border-radius: 3px;
      //}
    //}
  //}

  .button {
    display: inline-block;
    position: relative;
    bottom: 100px;
    width: 160px;
    height: 40px;
    margin: 0 auto;
    background-color: rgb(14,133,67);
    border-top: 3px solid rgb(95,171,133);
    border-bottom: 3px solid rgb(0,90,42);
    border-left: 3px solid rgb(95,171,133);
    border-right: 3px solid rgb(0,90,42);
    text-align: center;
    color: white;
    font-weight: bolder;
    font-size: 13px;
    opacity:0;
  }

  &:hover {
    cursor: pointer;
    //width: 300px;
    //height: 360px;
    //margin-left: 80px;
    //margin-bottom: 50px;
    //text-align: center;
    //border-top: 5px solid rgb(128,176,114);
    //border-bottom: 5px solid rgb(128,176,114);
    //border-left: 5px solid rgb(45,100,29);
    //border-right: 5px solid rgb(45,100,29);
    //background-color: white;

    //.button {
    //  display: inline-block;
    //  position: relative;
    //  bottom: 100px;
    //  width: 160px;
    //  height: 40px;
    //  margin: 0 auto;
    //  background-color: rgb(14,133,67);
    //  border-top: 3px solid rgb(95,171,133);
    //  border-bottom: 3px solid rgb(0,90,42);
    //  border-left: 3px solid rgb(95,171,133);
    //  border-right: 3px solid rgb(0,90,42);
    //  text-align: center;
    //  color: white;
    //  font-weight: bolder;
    //  font-size: 13px;
    //  opacity:1;
    //}
    //.button:hover{
    //  cursor: pointer;
    //  background-color: rgb(0,90,42);
    //  border-top: 3px solid rgb(14,133,67);
    //  border-bottom: 3px solid rgb(95,171,133);
    //  border-left: 3px solid rgb(14,133,67);
    //  border-right: 3px solid rgb(95,171,133);
    //}
  }
}

</style>
